#pragma once

#include "xict_cpp/core/stage/base.h"
#include <memory>
#include <string>
#include <vector>

namespace xict_cpp {
    namespace core {
        namespace pipeline {
            /// \brief Pipeline is the base class of all pipelines.
            /// \details It provides the basic unit for the node.
            /// The node is a series of pipelines, and each pipeline
            /// is responsible for a complete feature.
            class Pipeline {
            public:
                /// \brief Default constructor.
                Pipeline() = default;
                /// \brief Default destructor.
                virtual ~Pipeline() = default;

            public:
                // Key functions

                /// \brief Initialize the pipeline with the given parameters.
                /// \return True if the initialization is successful, false
                /// otherwise.
                virtual bool Init() = 0;

                /// \brief Start the pipeline.
                virtual void Start() = 0;

                /// \brief Stop the pipeline.
                virtual void Stop() = 0;

                /// \brief Get the name of the pipeline.
                /// \return The name of the pipeline.
                virtual std::string Name() const = 0;

            protected:
                // Internal functions

                /// \brief Internal initialization function for the pipeline.
                virtual bool Initialize() = 0;
                /// \brief Internal process function for the pipeline.
                virtual bool InnerProcess() = 0;
                /// \brief Reset the pipeline.
                virtual void Reset() = 0;

            protected:
                /// \brief Stages of the pipeline.
                std::vector<xict_cpp::core::stage::StagePtr> stages_;
            };

            using PipelinePtr      = std::shared_ptr<Pipeline>;
            using PipelineConstPtr = std::shared_ptr<const Pipeline>;
        }   // namespace pipeline
    }       // namespace core
}   // namespace xict_cpp
